package com.book.controller;

import com.book.dto.OrderPage;
import com.book.service.OrderService;
import com.book.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yicheng
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/getList")
    public ResponseResult getList(@RequestParam String userId, @RequestBody OrderPage orderPage){
        return orderService.getList(userId,orderPage);
    }

    @GetMapping("/getOne")
    public ResponseResult getOne(@RequestParam String orderId){
        return orderService.getOne(orderId);
    }

    @GetMapping("/updateStatus")
    public ResponseResult updateStatus(@RequestParam String orderId, @RequestParam int status){
        return orderService.updateStatus(orderId, status);
    }

    @GetMapping("/deleteOrder")
    public ResponseResult deleteOrder(@RequestParam String orderId){
        return orderService.deleteOrder(orderId);
    }
}
